<script>
$("#ovallera").addClass('current');
</script>
<?
$trayectos = array(1=>'Identificación', 2=>'Atenciones', 3=>'Manifestaciones', 4=>'Diagnosticos', 5=>'Examenes', 7=>'Finalizado');
$trayecto = array(1=>'Identificación', 2=>'Atenciones', 3=>'Manifestaciones', 4=>'Diagnosticos', 5=>'Examenes', 6=>'Conclusiones', 7=>'Finalizado');
?>
<div class="casos">
	<br/>
	<h2><?php __('Casos Retrospectivos');?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('Nro.', 'id');?></th>
			<th><?php echo $this->Paginator->sort('Cedula', 'cedula_trabajador');?></th>
			<th><?php echo 'Nombre(s) y Apellido(s)'?></th>
			<th><?php echo $this->Paginator->sort('trayecto');?></th>
			<th class="actions"><?php __('Acciones');?></th>
	</tr>
	<?php
	//pr($casos);
	$i = 0;
	foreach ($casos as $caso):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $caso['Caso']['id']; ?>&nbsp;</td>
		<td>
			<?php echo $caso['Caso']['cedula_trabajador']; ?>
		</td>
		<td><?php 
			if(empty($caso['Trabajador']['cedula'])){
				echo "N/A";
			}else{
				echo $caso['Trabajador']['nombre']." ".$caso['Trabajador']['apellido'];
			}
		?>&nbsp;
		</td>
		<td>
			<?
			 	if($caso['Caso']['trayecto'] == 7){
			 		echo $trayectos[$caso['Caso']['trayecto']];
			 	}else{
			 		echo $html->link($trayectos[$caso['Caso']['trayecto']], array('action'=>strtolower($trayecto[($caso['Caso']['trayecto']+1)]), $caso['Caso']['id']));
			 	}
				
			?>
		</td>
		<td class="actions">
			<?php
				if($caso['Caso']['trayecto'] == 7){
					echo $this->Html->link($html->image("material_info.png", array("width"=>"24", 'title'=>'Ver caso')), array('action' => 'view', $caso['Caso']['id']), array('escape'=>false));
					echo $this->Html->link($html->image("material_edit.png", array("width"=>"24", 'title'=>'Editar caso')), array('action' => 'pre_editar', $caso['Caso']['id']), array('escape'=>false));
				}else{
					echo "<a>".$html->image("info_disabled.png", array("width"=>"24", 'disabled'=>true))."</a>";
					echo "<a>".$html->image("editar_disabled.png", array("width"=>"24", 'disabled'=>true))."</a>";
				}
			?>
			<?php echo $this->Html->link($html->image("material_delete.png", array("width"=>"24", 'title'=>'Eliminar caso')), array('action' => 'delete', $caso['Caso']['id']), array("escape"=>false), sprintf(__('Are you sure you want to delete # %s?', true), $caso['Caso']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Página %page% de %pages%, mostrando %current% casos de %count% en total, comenzando con el caso %start%, y terminando en el %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>